package Class.Dialog;

import Class.Handler.*;
import Class.Dialog.*;
import Class.TextWindow.*;
import Class.Main.*;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class AboutTextBookDialog extends JDialog implements ActionListener {

    private TextWindow textWindow;
    private JLabel jLabel1 = new JLabel("WangHao");
    private JLabel jLabel2 = new JLabel("版本 1.0");
    private JLabel jLabel3 = new JLabel("@ South China Agricultural University。保留所有权利");
    private JLabel jLabel4 = new JLabel("该软件受保护,许可任何用户使用本产品");
    private JButton confirmButton = new JButton("确定");


    public AboutTextBookDialog(TextWindow textWindow){
        super(textWindow,"关于\"记事本\"",true);
        this.textWindow=textWindow;

        //建立框体，使用绝对布局，需指定坐标
        JPanel jPanel = new JPanel(null);
        jPanel.add(jLabel1);
        jPanel.add(jLabel2);
        jPanel.add(jLabel3);
        jPanel.add(jLabel4);
        jPanel.add(confirmButton);

        jLabel1.setBounds(50,140+20,120,25);
        jLabel2.setBounds(50,165+20,60,25);
        jLabel3.setBounds(50,190+20,420,25);
        jLabel4.setBounds(50,215+20,420,25);
        confirmButton.setBounds(470+20,340,90,28);

        this.getContentPane().add(jPanel);
        setSize(600,420);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);
        setVisible(true);

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource() == confirmButton){
            this.dispose();
        }
    }
}
